/**
 * Copyright (C)  2011  chen wei hua.
 * Permission is granted to copy, distribute and/or modify this document
 * under the terms of the GNU Free Documentation License, Version 2.0
 * or any later version published by the Free Software Foundation;
 * with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
 * A copy of the license is included in the section entitled "GNU Free Documentation License".
 */
package com.javaeye.chenweihuacwh.web.orderManage;

import java.util.List;

import com.javaeye.chenweihuacwh.dto.orderManage.CustomerOrder;
import com.javaeye.chenweihuacwh.service.orderManage.IOrderService;
import com.javaeye.chenweihuacwh.util.ListItem;
import com.javaeye.chenweihuacwh.util.ListUtil;

public class BusinessAction extends OrderAction {

	/**
	 * 
	 */
	private static final long serialVersionUID = -7408989332825417843L;

	private List<ListItem> logisticsTypeList;
	
	/**
	 * 查询需要业务确认的出货单列表
	 * @return
	 * @throws Exception
	 */
	public String queryBusinessList() throws Exception {
		getCondition().setStatus(new Object[]{IOrderService.ORDER_STATES_PLAN});
		return queryOrderList();
	}
	
	/**
	 * 查询用于业务确认
	 * @return
	 * @throws Exception
	 */
	public String queryOrderForBusiness() throws Exception {
		logisticsTypeList = ListUtil.logisticsTypeList();
		return queryOrderBaseInfo();
	}
	
	/**
	 * 保存业务确认
	 * @return
	 * @throws Exception
	 */
	public String saveOrderBusiness() throws Exception {
		CustomerOrder order = getService().getOrderBaseInfo(getOrderId());
		order.setOutDate(getOrder().getOutDate());
		order.setLogisticsType(getOrder().getLogisticsType());
		order.setArriveDate(getOrder().getArriveDate());
		getService().saveOrder(order);
		return SUCCESS;
	}

	public void setLogisticsTypeList(List<ListItem> logisticsTypeList) {
		this.logisticsTypeList = logisticsTypeList;
	}

	public List<ListItem> getLogisticsTypeList() {
		return logisticsTypeList;
	}
}
